package com.hz.userservice.mapper;

import com.hz.userservice.model.entity.GradeEntity;
import lombok.Data;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GradeMapper {
    @Insert("insert into grades values (null,#{grade_name},#{grade_year})")
    public int addGrade(GradeEntity gradeEntity);

    @Delete("delete from grades where id = #{gradeId}")
    public int deleteGrade(@Param("id")int gradeId);

    @Select("select * from grades")
    public List<GradeEntity> allGrades();

    @Select("select * from grades where grade_name = #{gradeName};")
    public GradeEntity findByGradeName(@Param("gradeName") String gradeName);

    @Select("select * from grades where id = #{gradeId};")
    public GradeEntity findByGradeId(@Param("gradeId") int gradeId);
}
